package com.feicheng.controller.admin;

import com.alibaba.fastjson.JSONObject;
import com.feicheng.common.result.ResultInfo;
import com.feicheng.persistence.service.IAkechengskjlService;
import com.feicheng.service.a.FKcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/skjl")
public class SkjlController {

    @Autowired
    FKcService kcService;

    @GetMapping("/page")
    public ResultInfo getByPage(
            @RequestParam(defaultValue = "1") Integer current,
            @RequestParam(defaultValue = "12") Integer size,
            String searchKey
    )
    {
        JSONObject param = new JSONObject();
        param.put("current", current);
        param.put("size", size);
        param.put("kcname", searchKey);
        param = kcService.getskjlsByPage(param);

          return ResultInfo.success(param.get("skjls"));
    }



    @GetMapping("/info")
    public ResultInfo getSkjlInfo(@RequestParam("skjlid") String skjlid){
        JSONObject param = new JSONObject();
        param.put("skjlid", skjlid);
        param = kcService.getSkjl(param);

        return  ResultInfo.success(param);

    }

}
